package com.fowo.api.inventory.model.form;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fowo.api.inventory.model.InventoryOutboundVo;
import com.fowo.api.inventory.model.PatternEnum;
import com.fowo.api.inventory.model.TargetTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 仓库出库表单请求
 * @author yl_ls
 */
@Getter
@Setter
@Accessors(chain = true)
public class InventoryOutboundFormVo extends InventoryStorageBaseVo {

    /**
     * 仓库内码
     */
    @Schema(title = "仓库内码")
    private Long stockId;

    /**
     * 选择模式
     */
    @Schema(title = "选择模式\n" +
            "    - LIFO: 后进先出\n" +
            "    - FIFO: 先进先出\n" +
            "    - ExpiryEarlier: 近有效期先出\"不新鲜\"\n" +
            "    - ExpiryLater: 远有效期先出\"新鲜\"")
    private PatternEnum model;

    /**
     * 出库源类型
     */
    @Schema(title = "出库源类型\n" +
            "    - Normal : 正常库存\n" +
            "    - Lock: 锁定库存\n" +
            "    - Display: 展示库存\n" +
            "    - Defect: 残次库存\n" +
            "    - Way: 在途库存")
    private TargetTypeEnum from;

    /**
     * 出库项目
     */
    @Schema(title = "出库项目")
    private List<InventoryOutboundVo> items;

    /**
     * 添加出库项目
     * @param item 出库项目
     * @return 自身
     */
    public InventoryOutboundFormVo add(InventoryOutboundVo item) {
        if (items == null) {
            items = new ArrayList<>();
        }
        items.add(item);
        return this;
    }
}
